Change in openvpn[master]: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
A message that is not in the archive (sent off-list or not yet received): gerrit.1743496145000.I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6@...2715...
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
to review the following change.
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name return a string instead of hardcoded NIDs that do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/927/1
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld.
Hello flichtenheld,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
to look at the new patch set (#2).
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/927/2
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld.
ordex has uploaded a new patch set (#3) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/927/3
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, ordex.
ordex has uploaded a new patch set (#4) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/927/4
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/927/comment/7f90eb24_00ca004f :
PS4, Line 2462: const char *signame = NULL;
I presume you added the empty line on the wrong side?
It should be below and not above?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 01 Apr 2025 11:41:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, ordex.
plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/927/comment/2c6e0983_be364558 :
PS4, Line 2462: const char *signame = NULL;
Quoted 1 line
I presume you added the empty line on the wrong side? […]
No. As signame belongs to the block below as helper variable while the other are valid for the whole function.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: ordex <[email protected]...>
Gerrit-Comment-Date: Tue, 01 Apr 2025 11:44:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, plaisthos.
ordex has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Patch Set 4: Code-Review+2
(2 comments)
Patchset:
PS4:
patch makes sense and does what it says.
Our openssl-ifdef-foomble-moomble is already a bit out of control and nothing this patch can do about...
File src/openvpn/ssl_openssl.c:
http://gerrit.openvpn.net/c/openvpn/+/927/comment/648cca6f_9030f9dc :
PS4, Line 2462: const char *signame = NULL;
Quoted 1 line
No. […]
Acknowledged
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 4
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 02 Apr 2025 13:50:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: ordex <[email protected]...>
Gerrit-MessageType: comment
PATCH v4 1/1 Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/927
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
PATCH v4 1/1 Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
In reply to a message not in the archiveFrom: Arne Schwabe <[email protected]...>
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/927
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
[Openvpn-devel] [PATCH applied] Re: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
Good change. Use the 3.5 function if available, and move all the #ifdef mumbo to the compat header. Not explicitly tested, just stared a bit at the code & relied on the buildbot tests.
Your patch has been applied to the master branch.
commit b60d2bb98c77d5836b7e3e2d21eeeb17aa55d3f2
Author: Arne Schwabe Date: Wed Apr 2 17:33:28 2025 +0200
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31336.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#5) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by ordex
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31336.html
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/27/927/5
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/927?usp=email )
Change subject: Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
......................................................................
Use SSL_get0_peer_signature_name instead of SSL_get_peer_signature_nid
SSL_get0_peer_signature_name returns a string instead of hardcoded NIDs. NIDS do not work with provider provided signatures or the new PQ signatures introduced in OpenSSL 3.5.
Remove also the comment that was added earlier that says that there is no proper API replacement for SSL_get_peer_signature_nid yet as OpenSSL 3.5.0 has now introduced it.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg31336.html
---
M src/openvpn/openssl_compat.h
M src/openvpn/ssl_openssl.c
2 files changed, 34 insertions(+), 11 deletions(-)
src/openvpn/openssl_compat.h +26 -0
@@ -173,4 +173,30 @@#endif /* OPENSSL_VERSION_NUMBER < 0x30000000L */ +#if OPENSSL_VERSION_NUMBER <0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL ) +static inline int +SSL_get0_peer_signature_name (SSL *ssl,const char **sigalg) +{ +int peer_sig_nid; +if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) + && peer_sig_nid != NID_undef) + { + *sigalg =OBJ_nid2sn (peer_sig_nid); +return 1 ; + } +return 0 ; +} +#elif defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER <=0x3050400fL +/* The older LibreSSL version do not implement any variant of getting the peer +* signature */ +static inline int +SSL_get0_peer_signature_name (const SSL *ssl,const char **sigalg) +{ + *sigalg =NULL ; +return 0 ; +} +#endif /* if OPENSSL_VERSION_NUMBER < 0x30500000 && (!defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER > 0x3050400fL) */ + + +#endif /* OPENSSL_COMPAT_H_ */
src/openvpn/ssl_openssl.c +8 -11
@@ -2454,20 +2454,17 @@static void print_peer_signature (SSL *ssl,char *buf,size_t buflen) { -int peer_sig_nid = NID_undef, peer_sig_type_nid = NID_undef; -const char *peer_sig ="unknown" ; +int peer_sig_type_nid = NID_undef; +const char *peer_sig_unknown ="unknown" ; +const char *peer_sig = peer_sig_unknown;const char *peer_sig_type ="unknown type" ; -/* Even though these methods use the deprecated NIDs instead of using -* string as new OpenSSL APIs do, there seem to be no API that replaces -* it yet */ -#if !defined(LIBRESSL_VERSION_NUMBER ) ||LIBRESSL_VERSION_NUMBER >0x3050400fL -if (SSL_get_peer_signature_nid (ssl, &peer_sig_nid) - && peer_sig_nid != NID_undef) +const char *signame =NULL ; +SSL_get0_peer_signature_name (ssl, &signame); +if (signame) { - peer_sig =OBJ_nid2sn (peer_sig_nid); + peer_sig = signame; } -#endif #if !defined(LIBRESSL_VERSION_NUMBER ) \ || (defined(LIBRESSL_VERSION_NUMBER ) &&LIBRESSL_VERSION_NUMBER >=0x3090000fL )
@@ -2480,7 +2477,7 @@ }#endif -if (peer_sig_nid == NID_undef && peer_sig_type_nid == NID_undef) +if (peer_sig == peer_sig_unknown && peer_sig_type_nid == NID_undef) {return ; }
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/927?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2bc782ceebcc91a8dc8ada0bb72ac042be46cad6
Gerrit-Change-Number: 927
Gerrit-PatchSet: 5
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged